package com.lehecai.core.type.sms;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;
/**
 * 运营商类型
 * @author leiming
 *
 */
public class MobileType extends IntegerBeanLabelItem {

	private static final long serialVersionUID = -8013814461233302001L;

	private static final Logger logger = LoggerFactory.getLogger(MobileType.class.getName());
	
	private static List<MobileType> items = new ArrayList<MobileType>();
	private static List<MobileType> queryItems = new ArrayList<MobileType>();
	
	protected MobileType(String name, int value, boolean queryOnly) {
		super(MobileType.class.getName(), name, value);
		
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	protected MobileType(String name, int value) {
		this(name, value, false);
	}
	
	public static MobileType getItem(int value){
		try {
			return (MobileType)MobileType.getResult(MobileType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<MobileType> getItems() {
		return items;
	}
	
	public static List<MobileType> getItemsForQuery() {
		return queryItems;
	}

	public static final MobileType DEFAULT = new MobileType("默认", 0);
	
	public static final MobileType CMCC = new MobileType("中国移动", 1);
	public static final MobileType CUCC = new MobileType("中国联通", 2);
	public static final MobileType CTCC = new MobileType("中国电信", 3);

}
